function PicSliser() {
    return new PicSliser.prototype.init();
}
PicSliser.prototype = {
    init: function() {
        var self = this;
        self.$parent = $('.slider');
        self.$ul = self.$parent.find('.slider-wrap');
        self.picNum = self.$ul.find('li').length;
        self.width = self.$parent.width();
        self.$ul.find('li').css('width',self.width);
        self.$ul.css('width', self.width * self.picNum);
        self.index = 0;
        self.picTranslate();
    },
    move: function() {
        var self = this;
        self.$ul.animate({
            'left':-self.width * self.index
        },400, 'swing');
        $('.slide-nav').find('li').eq(self.index)
            .addClass('selected').siblings().removeClass('selected');
    },
    moveNext: function() {
        var self = this;
        if(self.index >= self.picNum-1) {
            return;
        }
        self.index++;
        self.move();

    },
    moverPre: function() {
        var self = this;
        if(self.index <= 0) {
            return;
        }
        self.index--;
        self.move();
    },
    picTranslate: function() {
        var self = this,
            startPosition,
            endPOsition,
            deltaX,
            deltaY;
        self.$ul.find('.pic').bind('touchstart', function(e) {
            var touch = e.originalEvent.targetTouches[0];
            startPosition = {
                x: touch.pageX,
                y: touch.pageY
            }
        }).bind('touchmove', function(e) {
            var touch = e.originalEvent.targetTouches[0];
            endPosition = {
                x: touch.pageX,
                y: touch.pageY
            };
            deltaX = endPosition.x - startPosition.x;
            deltaY = endPosition.y - startPosition.y;
        }).bind('touchend', function(e) {
            if(deltaX < 0) {
                self.moveNext();
            } else if(deltaX > 0) {
                self.moverPre();
            }
        })

    }
}